package com.hereway.core.util;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.log4j.Logger;

public class LogInterceptor implements MethodInterceptor {

	@Override
	public Object invoke(MethodInvocation invocation) throws Throwable {
		Logger loger = Logger.getLogger(invocation.getClass());
		
		//方法前的操作
		loger.debug(invocation.getMethod() + ":BEGIN!");
		
		//执行需要Log的方法
		Object obj = invocation.proceed();
		
		//方法后的操作
		loger.debug(invocation.getMethod() + ":END!");

		return obj;
	}

}
